home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / xlib / xdraw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  1.7 KB  |  83 lines  |  [TEXT/CWIE]

  1. /* 
  2.  * xdraw.c --
  3.  *
  4.  *    This file contains generic procedures related to X drawing
  5.  *    primitives.
  6.  *
  7.  * Copyright (c) 1995 Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  * SCCS: @(#) xdraw.c 1.2 96/02/15 18:55:46
  13.  */
  14.  
  15. #include "tk.h"
  16.  
  17. /*
  18.  *----------------------------------------------------------------------
  19.  *
  20.  * XDrawLine --
  21.  *
  22.  *    Draw a single line between two points in a given drawable. 
  23.  *
  24.  * Results:
  25.  *    None.
  26.  *
  27.  * Side effects:
  28.  *    Draws a single line segment.
  29.  *
  30.  *----------------------------------------------------------------------
  31.  */
  32.  
  33. void
  34. XDrawLine(display, d, gc, x1, y1, x2, y2)
  35.     Display* display;
  36.     Drawable d;
  37.     GC gc;
  38.     int x1, y1, x2, y2;        /* Coordinates of line segment. */
  39. {
  40.     XPoint points[2];
  41.  
  42.     points[0].x = x1;
  43.     points[0].y = y1;
  44.     points[1].x = x2;
  45.     points[1].y = y2;
  46.     XDrawLines(display, d, gc, points, 2, CoordModeOrigin);
  47. }
  48.  
  49. /*
  50.  *----------------------------------------------------------------------
  51.  *
  52.  * XFillRectangle --
  53.  *
  54.  *    Fills a rectangular area in the given drawable.  This procedure
  55.  *    is implemented as a call to XFillRectangles.
  56.  *
  57.  * Results:
  58.  *    None
  59.  *
  60.  * Side effects:
  61.  *    Fills the specified rectangle.
  62.  *
  63.  *----------------------------------------------------------------------
  64.  */
  65.  
  66. void
  67. XFillRectangle(display, d, gc, x, y, width, height)
  68.     Display* display;
  69.     Drawable d;
  70.     GC gc;
  71.     int x;
  72.     int y;
  73.     unsigned int width;
  74.     unsigned int height;
  75. {
  76.     XRectangle rectangle;
  77.     rectangle.x = x;
  78.     rectangle.y = y;
  79.     rectangle.width = width;
  80.     rectangle.height = height;
  81.     XFillRectangles(display, d, gc, &rectangle, 1);
  82. }
  83.